<template>
  <div class="app">
    <h1>我是 爷爷</h1>

    <HelloFather :arr="list"></HelloFather>
  </div>
</template>

<script>
import HelloFather from "./components/HelloFather.vue";

export default {
  name: "App",

  components: {
    HelloFather,
  },

  data() {
    return {
      name: "李大枫",
      list: [],
    };
  },

  provide() {
    return {
      getList: this.getList,
    };
  },

  methods: {
    getList() {
      console.log("App - getList");
      // 这里默认请求数据
      setTimeout(() => {
        this.list = [
          { id: 1, name: "Apple" },
          { id: 2, name: "Banana" },
        ];
      }, 1000);
    },
  },

  mounted() {
    this.getList();
  },
};
</script>
